#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct ABC{
	int a,b;
}wz[500005];
int t,n;
int a[1000006];
int ans[1000006];
bool f(int l,int r,int mid)
{
	int ml=mid-1,mr=mid+1;
	for(int i=2;i<=n;i++)
	{
		if(a[l]==a[ml]&&l<ml)
		{
			ans[i]=0;
			ans[2*n-i+1]=0;
			l++;
			ml--;
			continue;
		}
		if(a[l]==a[mr]&&l<=ml)
		{
			ans[i]=0;
			ans[2*n-i+1]=1;
			l++;
			mr++;
			continue;
		}
		if(a[r]==a[mr]&&r>mr)
		{
			ans[i]=1;
			ans[2*n-i+1]=1;
			r--;
			mr++;
			continue;
		}
		if(a[r]==a[ml]&&r>=mr)
		{
			ans[i]=1;
			ans[2*n-i+1]=0;
			r--;
			ml--;
			continue;
		}
		return 0;
	}
	return 1;
}
int main()
{
	freopen("palin.in","r",stdin);
	freopen("palin.out","w",stdout);
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
		{
			wz[i].a=wz[i].b=0;
		}
		for(int i=1;i<=2*n;i++)
		{
			scanf("%d",&a[i]);
			if(wz[a[i]].a)
			{
				wz[a[i]].b=i;
			}
			else
			{
				wz[a[i]].a=i;
			}
		}
		ans[1]=0;
		ans[2*n]=0;
		if(!f(2,2*n,wz[a[1]].b))
		{
			ans[1]=1;
			if(!f(1,2*n-1,wz[a[2*n]].a))
			{
				printf("-1\n");
				continue;
			}
		}
		for(int i=1;i<=2*n;i++)
		{
			if(ans[i])	putchar('R');
			else		putchar('L');
		}
		printf("\n");
	}
	return 0;
}

